<?php
$count = 0;
$array_success = array();
$array_message = array();
$array_code = array();
$array_email = array();

foreach ($success as $s){
    $array_success[] = trim($s);
    $count++;
}
foreach ($message as $m){
    $array_message[] = trim($m);
}
foreach ($code as $c){
    $array_code[] = trim($c);
}
foreach ($emails as $email){
    $array_email[] = trim($email);
}

echo  json_encode(array(
                   "success"    => $array_success,
		   "message"	=> $array_message,
                   "code"	=> $array_code,
                   "emails"     => $array_email,
                   "count"      => $count,
   ));
?>